<script>
// import { h } from 'vue'
export default {
  name: 'XtxBread',
  render () {
    // 可以获取插槽中所有的内容
    const items = this.$slots.default()
    const result = []
    items.forEach((item, index) => {
      result.push(item)
      if (index < items.length - 1) {
        // 最后一个项目的箭头不再添加
        const itag = <i class='iconfont icon-angle-right'></i>
        // const itag = h('i', { class: 'iconfont icon-angle-right' }, null)
        result.push(itag)
      }
    })
    // return h('div', { class: 'xtx-bread' }, result)
    return <div class='xtx-bread'>{result}</div>
  }
}
</script>

<style lang='less'>
.xtx-bread {
  display: flex;
  padding: 25px 10px;
  &-item {
    a {
      color: #666;
      transition: all 0.4s;
      &:hover {
        color: @xtxColor;
      }
    }
  }
  i {
    font-size: 12px;
    margin-left: 5px;
    margin-right: 5px;
    line-height: 22px;
  }
}
</style>
